<script>
    // 扩展（剩余）运算符：...


    // 合并对象
    const obj1 = { a: 1, b: 2 };
    const obj2 = { c: 3, d: 4 };
    const mergaObj = { ...obj1, ...obj2, e: 5 };
    console.log(mergaObj);

    // 合并数组
    const arr1 = [1, 2];
    const arr2 = [3, 4];
    const mergaArr = [...arr1, ...arr2, 5, 6];
    console.log(mergaArr);

    // 接收数组剩余参数
    const pigFamily = ['猪爸爸', '猪妈妈', '佩奇', '乔治'];
    let [father, mother, ...child] = pigFamily;
    console.log(father, mother, child);

    // 接收函数剩余的实参
    function test(a, b, ...arg) {
        console.log(a);
        console.log(b);
        console.log(arg);
    }
    test(1, 2, 3, 4)




</script>